package com.hailiao.beidou.message.ui.page.search.view

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.d10ng.compose.ui.AppText
import com.d10ng.compose.ui.base.CellRow
import com.hailiao.beidou.message.ui.view.ContactAvatar

/**
 * 搜索展示行
 * @Author d10ng
 * @Date 2023/11/29 10:34
 */
@Composable
fun SearchAvatarCell(
    name: String,
    des: String,
    onClick: () -> Unit = {}
) {
    CellRow(
        modifier = Modifier
            .background(Color.White)
            .clickable { onClick() },
        divider = true,
        contentPaddingValues = PaddingValues(horizontal = 19.dp, vertical = 12.dp)
    ) {
        ContactAvatar(name = name)
        Column(
            modifier = Modifier
                .padding(start = 15.dp)
                .weight(1f)
        ) {
            Text(
                text = name,
                style = AppText.Normal.Title.medium,
                maxLines = 1,
                overflow = TextOverflow.Ellipsis
            )
            Text(
                text = des,
                style = AppText.Normal.Tips.mini,
                maxLines = 1,
                overflow = TextOverflow.Ellipsis
            )
        }
    }
}